package com.fanketly.funacg2.ui.components

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import coil.compose.AsyncImage
import coil.compose.AsyncImagePainter
import com.fanketly.funacg2.R
import com.fanketly.funacg2.data.network.RetrofitNetwork

@Composable
fun MyAsyncImage(
    model: String,
    modifier: Modifier = Modifier,
    onSuccess: ((AsyncImagePainter.State.Success) -> Unit)? = null,
    placeholder: Painter = painterResource(R.drawable.ic_not_photo),
    error: Painter = painterResource(R.drawable.ic_not_photo),
    contentScale: ContentScale = ContentScale.Crop,
) {
    AsyncImage(
        model = RetrofitNetwork.sBaseImageUrl + model,
        contentDescription = null,
        modifier = modifier,
        onSuccess =onSuccess ,
        placeholder = placeholder,
        error = error,
        contentScale = contentScale
    )
}